function Tabs($,commons){
	return {
		init:function(container,index,callback){
			index = index  || 1;
			this.container = container;
			this.callback = callback;
			this.events();
			this.jumpTo(index);
		},
		jumpTo:function(idx){
			// nav
			var selWord = ".tab-nav";
			this.container.find(selWord).removeClass("cur");
			selWord += '[tg="' + idx + '"]'
			this.container.find(selWord).addClass("cur");

			// page
			selWord = '.tab-page';
			this.container.find(selWord).removeClass("cur");
			selWord += '[tg="' + idx + '"]'
			this.container.find(selWord).addClass("cur");

			this.callback?this.callback.call(null,idx):void(0);
		},
		events:function(){
			var _this = this;
			$(_this.container).find(".tab-nav").on("click",function(){
				_this.jumpTo($(this).attr("tg"));
			});
		}
	}
}

if("function"==typeof define && define.amd && define){
	define(['jquery','common/pccommons'],function($,pcCommon){
		return Tabs($,pcCommon);
	});
}
